package com.kfirszt.elearning.persistence.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kfirszt.elearning.dictionary.Province;
import com.kfirszt.elearning.persistence.dao.CityDAO;
import com.kfirszt.elearning.persistence.model.City;

@Service("cityService")
public class CityServiceImpl implements
		CityService {

	@Autowired
	private CityDAO cityDAO;
	
	@Override
	public City findByNameAndProvinceOrCreate(String name, Province province) {
		return cityDAO.findByNameAndProvinceOrCreate(name, province);
	}

	@Override
	public List<City> findByName(String query) {
		return cityDAO.findByName(query);
	}

	@Override
	public void saveOrUpdate(City entity) {
		cityDAO.saveOrUpdate(entity);
	}

	@Override
	public void create(City city) {
		cityDAO.create(city);
	}
	
}
